<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>数据系统</title>
    <script src="{{url_for('static', path='/layui/echarts.min.js')}}"></script>
    <script src="{{url_for('static', path='/layui/layui.js')}}"></script>
    <script src="{{url_for('static', path='/layui/jquery-3.5.1.min.js')}}"></script>
    <!--    <script src="/jquery/jquery-1.11.1.min.js"></script>-->
    <link rel="stylesheet" href="{{url_for('static', path='/layui/css/layui.css')}}" media="all">
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">
            <h2 style="color: #eb7350">北极星</h2>
        </div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>
            <li id="analysis" class="layui-nav-item layui-hide-xs"><a href="/analysis">数据分析</a></li>
            <li id="users" class="layui-nav-item layui-hide-xs"><a href="/users">用户分析</a></li>
            <li id="report" class="layui-nav-item layui-hide-xs"><a href="/report">分析报告</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    </i>九章
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">个人信息</a></dd>
                    <dd><a href="">设置</a></dd>
                    <dd><a href="">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">

                {% if menu%}
                {% for tag in menu%}
                <li class="layui-nav-item">
                    <a id="{{tag['id']}}" class="" href="javascript:;" style="font-size: 14px;">{{tag['title']}}</a>
                    {% if tag['child']%}
                    <dl class="layui-nav-child">
                        {% for child in tag['child']%}
                        <dd><a id="{{child['id']}}" class="child" href="javascript:;">{{child['title']}}</a></dd>
                        {% endfor %}
                    </dl>
                    {% endif %}
                </li>
                {% endfor %}
                {% endif %}
            </ul>
        </div>
    </div>

    <div id="body" class="layui-body">

    </div>

    <div class="layui-footer">power by why</div>
</div>

<script>
    layui.use('element', function () {
        var element = layui.element;
    });
    var key = 0
    $('.child').click(function () {
            var path = $(this).attr("id")
            $.ajax({
                type: "get",
                url: "/analysis/"+path,
                success: function (data) {
                    $("#body").html("<iframe src='./" + path + "' height='100%' width='100%'></iframe>")
                },
                error : function(e){
                    $("#body").html("<h1>"+path+"</h1>")
                }
            });
        }
    );
</script>
</body>
</html>
